***** H2 - Parents hypothesis 

* Produce Tables 1 in Appendix Q & R	

		clear all
		
		cd "${data}"	
		use data_ess.dta, clear
		
		* FDR adjusted p-value - Parents hypothesis - Economy 
		
		
		foreach i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  {
			
		cd "${data}"	
		use data_ess.dta, clear
		parmby "reg stfeco b0.dummy1834 agea income b0.unemployed education unemployment_rate i.essround [pw=pspwght] if country_code==`i' & agea>34, robust",label norestore 
		qqvalue p, method(simes) qvalue(qval) 
		keep if parm=="1.dummy1834" 
		gen country = `i'
		save ${data}/eco_fdr_`i'.dta, replace 
		}
		
		foreach i in 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  {
			
		cd "${data}"	
		use data_ess.dta, clear
		parmby "reg stfeco b0.dummy1834 agea income b0.unemployed education unemployment_rate i.essround [pw=pspwght] if country_code==`i' & agea>34, robust",label norestore
		qqvalue p, method(simes) qvalue(qval) 
		keep if parm=="1.dummy1834" 
		gen country = `i'
		save ${data}/eco_fdr_`i'.dta, replace 
		}

		cd "${data}"
		use eco_fdr_1.dta, clear
		
		foreach i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 {
			
				append using eco_fdr_`i'.dta
			
		}

		cd "${tables}"
		

		drop parmseq parm dof label t
		
		generate cntry = "" 
		replace cntry="AT" if country==1
		replace cntry="BE" if country==2
		replace cntry="BG" if country==3
		replace cntry="CH" if country==4
		replace cntry="CY" if country==5
		replace cntry="CZ" if country==6
		replace cntry="DE" if country==7
		replace cntry="DK" if country==8
		replace cntry="EE" if country==9
		replace cntry="ES" if country==10
		replace cntry="FI" if country==11
		replace cntry="FR" if country==12
		replace cntry="GB" if country==13
		replace cntry="GR" if country==14
		replace cntry="HR" if country==15
		replace cntry="HU" if country==16
		replace cntry="IE" if country==17
		replace cntry="IL" if country==18
		replace cntry="IS" if country==19
		replace cntry="IT" if country==20
		replace cntry="LT" if country==21
		replace cntry="LU" if country==22
		replace cntry="NL" if country==23
		replace cntry="NO" if country==24
		replace cntry="PL" if country==25
		replace cntry="PT" if country==26
		replace cntry="RU" if country==27
		replace cntry="SE" if country==28
		replace cntry="SI" if country==29
		replace cntry="SK" if country==30
		replace cntry="TR" if country==31
		replace cntry="UA" if country==32
	
		order cntry
		drop country
		
		texsave  using "appendixQ_eco_fdr.tex", preamble("\usepackage{amsfonts}") size(small) replace 

	
		* FDR adjusted p-value - Parents hypothesis - Government 
		
				cd "${data}"	
		use data_ess.dta, clear
		
		
		foreach i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  {
			
		cd "${data}"	
		use data_ess.dta, clear
		parmby "reg stfgov b0.dummy1834 agea income b0.unemployed education unemployment_rate i.essround [pw=pspwght] if country_code==`i' & agea>34, robust",label norestore
		qqvalue p, method(simes) qvalue(qval) 
		keep if parm=="1.dummy1834" 
		gen country = `i'
		save ${data}/gov_fdr_`i'.dta, replace 
		}
		
		foreach i in 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  {
			
		cd "${data}"	
		use data_ess.dta, clear
		parmby "reg stfgov b0.dummy1834 agea income b0.unemployed education unemployment_rate i.essround [pw=pspwght] if country_code==`i' & agea>34, robust",label norestore
		qqvalue p, method(simes) qvalue(qval) 
		keep if parm=="1.dummy1834" 
		gen country = `i'
		save ${data}/gov_fdr_`i'.dta, replace 
		}

		cd "${data}"
		use gov_fdr_1.dta, clear
		
		foreach i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 {
			
				append using gov_fdr_`i'.dta
			
		}

		cd "${tables}"
		
		
		drop parmseq parm dof label t
		
		generate cntry = "" 
		replace cntry="AT" if country==1
		replace cntry="BE" if country==2
		replace cntry="BG" if country==3
		replace cntry="CH" if country==4
		replace cntry="CY" if country==5
		replace cntry="CZ" if country==6
		replace cntry="DE" if country==7
		replace cntry="DK" if country==8
		replace cntry="EE" if country==9
		replace cntry="ES" if country==10
		replace cntry="FI" if country==11
		replace cntry="FR" if country==12
		replace cntry="GB" if country==13
		replace cntry="GR" if country==14
		replace cntry="HR" if country==15
		replace cntry="HU" if country==16
		replace cntry="IE" if country==17
		replace cntry="IL" if country==18
		replace cntry="IS" if country==19
		replace cntry="IT" if country==20
		replace cntry="LT" if country==21
		replace cntry="LU" if country==22
		replace cntry="NL" if country==23
		replace cntry="NO" if country==24
		replace cntry="PL" if country==25
		replace cntry="PT" if country==26
		replace cntry="RU" if country==27
		replace cntry="SE" if country==28
		replace cntry="SI" if country==29
		replace cntry="SK" if country==30
		replace cntry="TR" if country==31
		replace cntry="UA" if country==32
	
		order cntry
		drop country
		
		texsave  using "appendixR_gov_fdr.tex", preamble("\usepackage{amsfonts}")  size(small) replace
		
		
		
		
	
